package com.lmy.dp01.util;

import com.lmy.dp01.constant.REnum;
import com.lmy.dp01.vo.R;

public class RUtil {

    public static R success(Object object, Long count){
        R r = new R();
        r.setCode(0);
        r.setData(object);
        r.setCount(count);
        r.setMsg("成功");
        return r;
    }

    public static R success(Object object){
        return success(object, null);
    }

    public static R success(){
        return success(null);
    }

    public static R error(Integer code, String msg){
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }

    public static R error(REnum rEnum){
        R r = new R();
        r.setCode(rEnum.getCode());
        r.setMsg(rEnum.getMsg());
        return r;
    }
}
